<?php

class GridFieldLoginAction extends Extension {
    private static $allowed_actions = array(
        'login'
    );
    
    public function login($request) {
        $controller = $this->owner->getController();
        while($controller && $controller instanceof GridFieldDetailForm_ItemRequest) {
            $controller = $controller->getController();
        }

		Session::set('CustomLoginID', $this->owner->record->ID);
		$page = MemberAreaPage::get()->find('ClassName', 'MemberAreaPage');
        return $controller->redirect($page->Link());
    }
}
